// 导入路由
import { Router, Route, Switch, Redirect } from 'react-router-dom';
/* 
   BrowserRouter  等于 Router + history 
   当手动配置 history 时 使用Router组件替代BrowserRouter 
*/

// 导入页面组件
import Login from './pages/Login';
import Layout from './pages/Layout';
import AuthRoute from './components/AuthRoute';
import history from 'utils/history';
import Test from './pages/Test';

// 配置路由规则
export default function App() {
  return (
    <Router history={history}>
      <div className="App">
        {/* 路由规则 */}
        <Switch>
          <Route path="/test" component={Test}></Route>
          <Route path="/login" component={Login}></Route>
          {/* 路由访问鉴权 登录访问控制 */}
          <AuthRoute path="/" component={Layout}></AuthRoute>
        </Switch>
      </div>
    </Router>
  );
}
